API Documentation
Public Member Functions | List of all members
nkAstraeus::DofComplexEffect Class Referencefinal

A Depth of Field effect. More...

Inheritance diagram for nkAstraeus::DofComplexEffect:
nkAstraeus::ComplexEffect

Public Member Functions

 DofComplexEffect (const nkMemory::StringView &name)
 
 ~DofComplexEffect ()
 
virtual COMPLEX_EFFECT_TYPE getType () const override
 
nkGraphics::TexturegetSourceTexture () const
 
nkGraphics::TexturegetSourceDepth () const
 
nkGraphics::TexturegetOutputTexture () const
 
nkGraphics::CameragetCamera () const
 
float getNearPlaneDistance () const
 
float getFocalPlaneDistance () const
 
float getFarPlaneDistance () const
 
unsigned int getBlurStrength () const
 
bool getLinearDepth () const
 
void setSourceTexture (nkGraphics::Texture *value)
 
void setSourceDepth (nkGraphics::Texture *value)
 
void setCamera (nkGraphics::Camera *value)
 
void setNearPlaneDistance (float value)
 
void setFocalPlaneDistance (float value)
 
void setFarPlaneDistance (float value)
 
void setBlurStrength (unsigned int value)
 
void setLinearDepth (bool value)
 
virtual bool load () override
 
virtual void unload () override
 
- Public Member Functions inherited from nkAstraeus::ComplexEffect
 ComplexEffect ()
 
virtual ~ComplexEffect ()
 
nkMemory::StringView getName () const
 
nkGraphics::CompositorNodegetCompositorNode () const
 
void setName (const nkMemory::StringView &value)
 
void setCompositorNode (nkGraphics::CompositorNode *value)
 

Detailed Description

A Depth of Field effect.

This effect will mimick the depth of field of a camera, and blur everything that is not in the focal plane of it. It is typically used to give a good sense of depth to an image, and can sometimes fool perception. For instance, a very narrow focal area (near and far close to each other) will make everything feel small, like small toys. It can also make obvious the parts that should attract attention, by focusing on the important objects in a given scene and blurring all its surrounding.

Constructor & Destructor Documentation

◆ DofComplexEffect()

nkAstraeus::DofComplexEffect::DofComplexEffect ( const nkMemory::StringView name)

Default constructor. See ComplexEffectManager::createOrRetrieve().

◆ ~DofComplexEffect()

nkAstraeus::DofComplexEffect::~DofComplexEffect ( )

Default destructor. See ComplexEffectManager::erase().

Member Function Documentation

◆ getType()

virtual COMPLEX_EFFECT_TYPE nkAstraeus::DofComplexEffect::getType ( ) const
overridevirtual
Returns
The effect type, COMPLEX_EFFECT_TYPE::DOF in this case.

Implements nkAstraeus::ComplexEffect.

◆ getSourceTexture()

nkGraphics::Texture* nkAstraeus::DofComplexEffect::getSourceTexture ( ) const
Returns
The source color texture used by the effect.

◆ getSourceDepth()

nkGraphics::Texture* nkAstraeus::DofComplexEffect::getSourceDepth ( ) const
Returns
The source depth texture used by the effect.

◆ getOutputTexture()

nkGraphics::Texture* nkAstraeus::DofComplexEffect::getOutputTexture ( ) const
Returns
The texture the effect will finally output to.
Remarks
This texture is tied to the lifetime of the ComplexEffect it is linked to. It will be usable as long as the effect is alive and won't change even after loading operations.

◆ getCamera()

nkGraphics::Camera* nkAstraeus::DofComplexEffect::getCamera ( ) const
Returns
Current set camera.

◆ getNearPlaneDistance()

float nkAstraeus::DofComplexEffect::getNearPlaneDistance ( ) const
Returns
Current near plane distance.

◆ getFocalPlaneDistance()

float nkAstraeus::DofComplexEffect::getFocalPlaneDistance ( ) const
Returns
Current focal plane distance.

◆ getFarPlaneDistance()

float nkAstraeus::DofComplexEffect::getFarPlaneDistance ( ) const
Returns
Current far plane distance.

◆ getBlurStrength()

unsigned int nkAstraeus::DofComplexEffect::getBlurStrength ( ) const
Returns
Current blurring strength.

◆ getLinearDepth()

bool nkAstraeus::DofComplexEffect::getLinearDepth ( ) const
Returns
Whether the depth data is considered linear (true) or not (false).

◆ setSourceTexture()

void nkAstraeus::DofComplexEffect::setSourceTexture ( nkGraphics::Texture value)

Sets the texture to use as input to the effect.

Parameters
valueThe texture to use as input.
Remarks
This parameter does not need a reload of the effect to be taken into account.

◆ setSourceDepth()

void nkAstraeus::DofComplexEffect::setSourceDepth ( nkGraphics::Texture value)

Sets the depth texture to use as input to the effect.

Parameters
valueThe depth texture to use as input.
Remarks
This parameter does not need a reload of the effect to be taken into account.

◆ setCamera()

void nkAstraeus::DofComplexEffect::setCamera ( nkGraphics::Camera value)

Sets the camera used to retrieve the projection parameters from. Defaults to nullptr, retrieving the camera information from the active context's camera.

Parameters
valueThe camera to use to get the projection information.
Remarks
This parameter does not need a reload of the effect to be taken into account.

◆ setNearPlaneDistance()

void nkAstraeus::DofComplexEffect::setNearPlaneDistance ( float  value)

Sets the near plane distane, in world unit, from the camera. All pixels closer than this distance will get fully blurred. Between the focal plane and the near plane, pixels will gradually get blurrier as they approach the near plane.

Parameters
valueThe near distance, in world unit.
Remarks
This parameter does not need a relead of the effect to be taken into account.

◆ setFocalPlaneDistance()

void nkAstraeus::DofComplexEffect::setFocalPlaneDistance ( float  value)

Sets the focal plane distane, in world unit, from the camera. This distance is the one for which the pixels will be in focus and thus sharp. As pixels get closer to the near or far plane, they will get blurrier.

Parameters
valueThe focal distance, in world unit.
Remarks
This parameter does not need a relead of the effect to be taken into account.

◆ setFarPlaneDistance()

void nkAstraeus::DofComplexEffect::setFarPlaneDistance ( float  value)

Sets the far plane distane, in world unit, from the camera. All pixels further away than this distance will get fully blurred. Between the focal plane and the far plane, pixels will gradually get blurrier as they approach the far plane.

Parameters
valueThe far distance, in world unit.
Remarks
This parameter does not need a relead of the effect to be taken into account.

◆ setBlurStrength()

void nkAstraeus::DofComplexEffect::setBlurStrength ( unsigned int  value)

Sets the blurring strength when reaching either the near or far plane. This can be interpreted as the the final blurring radius. Defaults to 3.

Parameters
valueThe blurring strength to apply.
Remarks
This parameters needs the effect to be reloaded if need be, to be taken into account.

◆ setLinearDepth()

void nkAstraeus::DofComplexEffect::setLinearDepth ( bool  value)

Sets whether the depth information texture should be considered linear, or not. Linear depth information will be between [0, 1] and simply be mapped to the camera's settings (near + depth * (far - near)). If not linear, then the camera's projection parameter will be used to reconstruct linear depth before deducing the depth in world units. Defaults to false.

Parameters
valueWhether depth data should be considered as already linear (true) or not (false).
Remarks
This parameter needs the effect to be reloaded if need be, to be taken into account.

◆ load()

virtual bool nkAstraeus::DofComplexEffect::load ( )
overridevirtual

◆ unload()

virtual void nkAstraeus::DofComplexEffect::unload ( )
overridevirtual

The documentation for this class was generated from the following file: